﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using SharpMap.Presentation.Wpf;
using System.Windows;

namespace SharpMap.Wpf
{
    class MapControlViewModel : INotifyPropertyChanged
    {
        public Map Map
        {
            get { return _map; }
            set 
            { 
                _map = value;
                RaisePropertyChanged("Map");
            }
        }

        //public MapViewModel MapViewModel
        //{
        //    get { return _mapViewModel; }
        //}

        //public MapControlViewModel(Map map)
        //{
        //    SharpMap.Presentation.Views.IMapView2D iView =
        //       view  as SharpMap.Presentation.Views.IMapView2D;
        //    if (iView != null && map != null)
        //    {
        //        Map = map;
        //        _mapViewModel = new MapViewModel(Map, iView);
        //        view.DataContext = _mapViewModel;
        //    }
        //}

        public MapControlViewModel(Map map)
        {
              Map = map;
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                PropertyChangedEventArgs args =
                    new PropertyChangedEventArgs(propertyName);
                handler(this, args);
            }
        }

        #endregion

        Map _map;


        //MapViewModel _mapViewModel;
    }
}
